package nl.myhealth.app.myhealthapp;

import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.TextView;

import nl.myhealth.app.myhealthapp.connection.ConnectThread;
import nl.myhealth.app.myhealthapp.connection.ConnectedThread;
import nl.myhealth.app.myhealthapp.connection.MeasurementReciever;


public class PressureMeasurmentActivity extends ActionBarActivity implements MeasurementReciever {

    private TextView output;
    private ConnectedThread thread;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_pressure_measurment);
        output = (TextView)findViewById(R.id.pressure_measurement_text);
    }

    @Override
    protected void onResume() {
        try {
            super.onResume();
            thread = new ConnectedThread(MyHealthApplication.socket, this);
            thread.start();
        }catch (Exception e)
        {
            e.printStackTrace();
        }
    }

    @Override
    public void recieveMeasurement(String json) {
        MyHealthApplication.addPressureMeasurement(json);
    }

    @Override
    protected void onStop() {
        super.onStop();
        //thread.cancel();
    }
}
